Skip to content

8357176: java.awt javadoc code examples still use Applet API #25278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

prrace
Copy link
Contributor

@prrace prrace commented May 16, 2025

Update the some code examples and accompanying images to no longer mention or display as applets.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Warnings

 ⚠️ Patch contains a binary file (src/java.desktop/share/classes/java/awt/doc-files/BorderLayout-1.png)
 ⚠️ Patch contains a binary file (src/java.desktop/share/classes/java/awt/doc-files/FlowLayout-1.png)
 ⚠️ Patch contains a binary file (src/java.desktop/share/classes/java/awt/doc-files/GridBagLayout-1.png)
 ⚠️ Patch contains a binary file (src/java.desktop/share/classes/java/awt/doc-files/GridBagLayout-2.png)
 ⚠️ Patch contains a binary file (src/java.desktop/share/classes/java/awt/doc-files/GridLayout-1.png)
 ⚠️ Patch contains a binary file (src/java.desktop/share/classes/java/awt/doc-files/GridLayout-2.png)

Issue

  • JDK-8357176: java.awt javadoc code examples still use Applet API (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25278/head:pull/25278
$ git checkout pull/25278

Update a local copy of the PR:
$ git checkout pull/25278
$ git pull https://git.openjdk.org/jdk.git pull/25278/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 25278

View PR using the GUI difftool:
$ git pr show -t 25278

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25278.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 16, 2025

👋 Welcome back prr! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented May 16, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot changed the title 8357176 8357176: java.awt javadoc code examples still use Applet API May 16, 2025
@openjdk openjdk bot added the rfr Pull request is ready for review label May 16, 2025
@openjdk
Copy link

openjdk bot commented May 16, 2025

@prrace The following label will be automatically applied to this pull request:

  • client

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the client client-libs-dev@openjdk.org label May 16, 2025
@mlbridge
Copy link

mlbridge bot commented May 16, 2025

Webrevs

@mrserb
Copy link
Member

mrserb commented May 19, 2025

It seems the new screenshots could be improved by capturing them on a HiDPI (Retina) display, as the current images appear blurry. And to eliminate background elements in the corners, it might be better to capture screenshots of undecorated windows as was done in the old images.

* gridbag.setConstraints(button, c);
* add(button);
* }
* static void addButton(String name,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* static void addButton(String name,
* private static void addButton(String name,

Comment on lines +288 to +295
* static void addButton(String name,
* GridBagLayout gridbag,
* GridBagConstraints c,
* Frame frame) {
* Button button = new Button(name);
* gridbag.setConstraints(button, c);
* frame.add(button);
* }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The add method should indented by 4 spaces to the right.

Comment on lines +297 to +303
* public static void main(String[] args) throws Exception {
*
* setFont(new Font("SansSerif", Font.PLAIN, 14));
* setLayout(gridbag);
* EventQueue.invokeAndWait(() -> {
* Frame frame = new Frame("GridBagLayout");
* GridBagLayout gridbag = new GridBagLayout();
* GridBagConstraints c = new GridBagConstraints();
* frame.setLayout(gridbag);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main method should be indented by 4 spaces to the right, it's inside GridBagLayoutExample class.

* <div style="margin:0 auto;width:680px;text-align:center;font-weight:bold">
* <div style="margin:0 auto;width:850px;text-align:center;font-weight:bold">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to keep the width small as it was?

* tracker.addImage(bg, 0);
* for (int i = 0; i < 5; i++) {
* anim[i] = getImage(getDocumentBase(),
* "images/anim"+i+".gif");
* anim[i] = tk.getImage("anim"+i+".gif");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* anim[i] = tk.getImage("anim"+i+".gif");
* anim[i] = tk.getImage("anim" + i + ".gif");

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The images would look better with square borders… which are left on Windows 10 only.

If it's possible to make the pixels on the rounded corners transparent or at least white, the images would look better.

@aivanov-jdk
Copy link
Member

It seems the new screenshots could be improved by capturing them on a HiDPI (Retina) display, as the current images appear blurry. And to eliminate background elements in the corners, it might be better to capture screenshots of undecorated windows as was done in the old images.

To make the screenshots look good on High DPI displays, we need several images (preferably at 100%, 150% and 200% as the most common scales) and use the srcset attribute of the <img> element to provide different resolutions.

If you just create a screenshot on (Retina at 200% scale), the screenshots will be too large and still blurry as browsers will still scale up the screenshots to the scale of the display because the src attribute is treated as 100%-scale candidate only.


If we agree to go this way, I can create screenshots on Windows 10 (which still uses square window borders) in different resolutions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client client-libs-dev@openjdk.org rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

3 participants